import { defineStore } from 'pinia'
import { getApiList } from '@/server/index'
import type { RootObject, Children, ChinaAdd, ChinaTotal, StatisGradeCityDetail } from 'src/stores/type'
export const useStore = defineStore({
  id: 'counter',
  state: () => ({
    list: <RootObject>{},
    item: <Children[]>[],
    chinaAdd: <ChinaAdd>{},
    chinaTotal: <ChinaTotal>{},
    cityDetail: <StatisGradeCityDetail[]>[],

  }),
  getters: {

  },
  actions: {
    async getList() {
      const res: any = await getApiList()
      this.list = res
      this.chinaAdd = this.list.diseaseh5Shelf.chinaAdd
      this.chinaTotal = this.list.diseaseh5Shelf.chinaTotal
      this.cityDetail = this.list.localCityNCOVDataList.slice(0, 10)//数据太多 只取前十个
    }

  }
})
